<?php
#Sorts the items in the list in ASCII order
function asciiSort($items) {
	sort($items);
	return $items;
}

#Lists all non-directory files in the provided path 
function listFileNames($dir) {
	$d = dir($dir) or die("Wrong path: $dir");
	while (false !== ($entry = $d->read())) {
		if($entry != '.' && $entry != '..' && !is_dir($dir.$entry)) {
			$files[] = $entry;
		}
	}
	$d->close();
	return $files;
}

#Lists all non-directory files in the provided path and sorts the names in ASCII order
function listFileNamesASCIISort($dir) {
	$files = listFileNames($dir);
	sort($files);
	return $files;
}

?>